﻿import {updatePromotuon,findId,findPageCondition} from '../../../api/Promotion/promotion'
let update={
    data() {

        return {

            //申请单
            PromotionInfo: {
                promotionId: this.$route.params.promotionId,  //id序号
                promotionName: "",  //活动名字
                promotionStarttime: "",  //开始时间
                promotionStoptime: "",  //活动结束时间
                promotionType: "", //活动类型
                priceTaketime: "", //生效时间
                priceLosetime: "",//失效时间
                promotionFile: "", //上传文件地址
                promotionApplicant: "",//申请人
                promotionApplicanttime: "",//申请时间
                promotionRemarks: "", // 备注信息
                promotionApprover: "",  //审批人
                promotionApprovertime: "",  //审批时间
                promotionApprovalstatus: "",  //审批状态
                promotionApproveridea: "",  //审批意见

                goodId: "", //商品id
                goodName:"",  //商品名字
                goodStock:"", //库存数
                promotionNum:"", //促销数
                marketPrice:"", //市场价
                storePrice:"", //商城价
                adiustPriceWay: "",//调价方式
                promotionPrice: "",//促销价格
                percent: "" //调价百分比
            },


            // PromotionInfo2:{
            //     promotionId:this.$route.params.promotionId,  //id序号
            //     promotionName:"",  //活动名字
            //     promotionStarttime:"",  //开始时间
            //     promotionStoptime:"",  //活动结束时间
            //     promotionType:"", //活动类型
            //     priceTaketime:"", //生效时间
            //     priceLosetime:"",//失效时间
            //     promotionFile:"", //上传文件地址
            //     promotionApplicant:"",//申请人
            //     promotionApplicanttime:"",//申请时间
            //     promotionRemarks:"", // 备注信息
            //     goodId:"", //商品id
            //     promotionPrice:"" ,//促销价格
            //     adiustPriceWay:"" ,//调价方式
            //     percent:"" //调价百分比
            // },
            produckInfo:[],
            applyId:"",

        };
    },
    methods: {
        findApply(){  //查找订单
            findPageCondition( this.PromotionInfo).then(response=> {
                this.produckInfo = response.data;
                this.PromotionInfo.promotionName = response.data[0].promotionName;
                this.PromotionInfo.goodName = response.data[0].promotionStarttime;
                this.PromotionInfo.promotionStoptime = response.data[0].promotionStoptime;
                this.PromotionInfo.promotionType = response.data[0].promotionType;
                this.PromotionInfo.priceTaketime = response.data[0].priceTaketime;
                this.PromotionInfo.priceLosetime = response.data[0].priceLosetime;
                this.PromotionInfo.promotionRemarks = response.data[0].promotionRemarks;

                this.PromotionInfo.goodId = response.data[0].goodId;
                this.PromotionInfo.goodName = response.data[0].goodName;
                this.PromotionInfo.goodStock = response.data[0].goodStock;
                this.PromotionInfo.marketPrice = response.data[0].marketPrice;
                this.PromotionInfo.storePrice = response.data[0].storePrice;
                this.PromotionInfo.promotionNum = response.data[0].promotionNum;
                this.PromotionInfo.adiustPriceWay = response.data[0].adiustPriceWay;
                this.PromotionInfo.promotionPrice = response.data[0].promotionPrice;
                this.PromotionInfo.percent = response.data[0].percent;
            })
        },
        select2() {  //选择商品
            this.$router.push({
                path: "/good",
            })
        },
        backtrack(){ //返回
            this.$router.push({
                path: "/Promotion",
            })
        },
        updatePromotion() { //修改
            updatePromotuon(this.PromotionInfo)
            this.$router.push({
                path: "/Promotion",
            })
        }
    },
        created(){
        this.findApply();
        }
};

export default update;

